home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
int24.arc
/
INT24.ASM
next >
Wrap
Assembly Source File
|
1988-01-06
|
2KB
|
98 lines
name INT24_HANDLER
CGroup group Code
assume cs: CGroup
Code segment 'CODE'
even
public InstallINT24
Int24_Handler_Next dd ?
Message db 'Plug the cable back in. Trying again.',0
Int24Handler proc near
push bx
mov bx, di
cmp bl, 0Ch ;General Failure
jne GoNextInt24
;This is the part that could be just about anything.
;All I do is tell the user to plug the cable back in.
push cs
pop ds
call Cursor_Address
mov si, offset CGroup: Message
call Write_String
pop bx
assume ds: nothing
mov al, 1 ;retry the operation
iret
GoNextInt24:
pop bx
jmp [Int24_Handler_Next]
Int24Handler endp
;Assumptions: DH, DL -- cursor postion
; DS:SI -- string address (NULL terminated)
Write_String proc near
mov cx, 1 ;output 1 char at a time
Write_String1:
lodsb
or al, al ;is it a zero ?
je Write_String_Exit
mov ah, 10
int 10h
mov ah, 2
inc dl
int 10h
jmp Write_String1
Write_String_Exit:
ret
Write_String endp
;On Return DX will contain the address of the cursor.
; DH is row and DL is column.
Cursor_Address proc near
mov ax, 40h ;point es to BIOS segment
mov es, ax
mov di, 63h ;point DI to address word
mov dx, es:[di] ;get CRTC address, this will be 3B4h
mov al, 14 ;OUT register number
out dx, al ;increment to 3B5h
inc dx ;point dx to Data Register
in al, dx ;read high byte of cursor address
mov ah, al
dec dx ;point dx to Address Register, will 3B4h
mov al, 15 ;OUT next register
out dx, al
inc dx ;point DX to Data Register
in al, dx ;read low byte of address
and ax, 07FFh ;strip PAGE bits from address
mov bl, 80 ;then divide by 80
div bl
xchg ah, al ;reverse byte for proper form
mov dx, ax ;cursor position
ret
Cursor_Address endp
InstallINT24 proc near
push cs
pop ds
mov ax, 3524h ;get vector
int 21h
mov word ptr Int24_Handler_Next+2, es
mov word ptr Int24_Handler_Next, bx
lea dx, Int24Handler ;load address of my handler
mov ax, 2524h ;set vector
int 21h
assume ds: nothing
ret
InstallINT24 endp
Code ends
end